'use strict';

const Controller = require('egg').Controller;

class ReadyController extends Controller {
  async establish() {
    const { ctx, service } = this;
    const state = await service.ready.found(ctx.request.body);
    this.ctx.body = JSON.stringify(state);
  }

  async join() {
    const { ctx, service } = this;
    const state = await service.ready.player(ctx.request.body);
    this.ctx.body = JSON.stringify(state);
  }
}

module.exports = ReadyController;
